import { IPublicTypeComponentMetadata, IPublicTypeSnippet } from '@alilc/lowcode-types';

const MaterialManagementMeta: IPublicTypeComponentMetadata = {
  componentName: 'MaterialManagement',
  title: '物资管理',
  category: '信息展示',
  group: '气象防灾',
  docUrl: '',
  screenshot: '',
  devMode: 'proCode',
  npm: {
    package: 'hzdz-charts',
    version: '0.1.0',
    exportName: 'MaterialManagement',
    main: 'src/index.tsx',
    destructuring: true,
    subName: ''
  },
  props: [
    {
      name: 'ref',
      propType: 'object',
    },
    {
      name: 'key',
      propType: 'string',
    },
    {
      name: 'style',
      propType: 'object',
    },
    {
      name: 'className',
      propType: 'string',
    },
    {
      name: 'width',
      propType: 'number',
      description: '组件宽度'
    },
    {
      name: 'height',
      propType: 'number',
      description: '组件高度'
    },
    {
      name: 'tabs',
      propType: 'array',
      description: '仓库标签列表'
    },
    {
      name: 'activeTabBackground',
      propType: 'string',
      description: '活跃标签背景图'
    },
    {
      name: 'inactiveTabBackground',
      propType: 'string',
      description: '非活跃标签背景图'
    },
    {
      name: 'borderColor',
      propType: 'string',
      description: '边框颜色'
    },
    {
      name: 'backgroundColor',
      propType: 'string',
      description: '背景颜色'
    },
    {
      name: 'stats',
      propType: 'array',
      description: '统计数据列表'
    },
    {
      name: 'tableHeaders',
      propType: 'object',
      description: '表格头部'
    },
    {
      name: 'records',
      propType: 'array',
      description: '物资记录列表'
    },
    {
      name: 'activeTabTextColor',
      propType: 'string',
      description: '活跃标签文字颜色'
    },
    {
      name: 'inactiveTabTextColor',
      propType: 'string',
      description: '非活跃标签文字颜色'
    },
    {
      name: 'headerTextColor',
      propType: 'string',
      description: '表头文字颜色'
    },
    {
      name: 'recordTextColor',
      propType: 'string',
      description: '记录文字颜色'
    },
    {
      name: 'statValueColor',
      propType: 'string',
      description: '统计值颜色'
    },
    {
      name: 'statLabelColor',
      propType: 'string',
      description: '统计标签颜色'
    },
    {
      name: 'showGradientText',
      propType: 'bool',
      description: '显示渐变文字'
    },
    {
      name: 'tableRowBackground',
      propType: 'string',
      description: '表格行背景'
    },
    {
      name: 'theme',
      propType: 'string',
      description: '主题'
    },
    {
      name: 'onTabClick',
      propType: 'func',
      description: '标签点击事件'
    },
    {
      name: 'onRecordClick',
      propType: 'func',
      description: '记录点击事件'
    },
    {
      name: 'onClick',
      propType: 'func',
      description: '点击事件'
    }
  ],
  configure: {
    props: [
      {
        name: 'activeTabBackground',
        title: { label: { type: 'i18n', 'en-US': 'activeTabBackground', 'zh-CN': '活跃标签背景图' } },
        setter: { componentName: 'StringSetter', isRequired: false, initialValue: 'http://localhost:8085/static/images/qixiangfangzhai/bz149bf.png' }
      },
      {
        name: 'inactiveTabBackground',
        title: { label: { type: 'i18n', 'en-US': 'inactiveTabBackground', 'zh-CN': '非活跃标签背景图' } },
        setter: { componentName: 'StringSetter', isRequired: false, initialValue: 'http://localhost:8085/static/images/qixiangfangzhai/jxbf2.png' }
      },
      {
        name: 'borderColor',
        title: { label: { type: 'i18n', 'en-US': 'borderColor', 'zh-CN': '边框颜色' } },
        setter: { componentName: 'ColorSetter', isRequired: false, initialValue: '#3A4E74' }
      },
      {
        name: 'backgroundColor',
        title: { label: { type: 'i18n', 'en-US': 'backgroundColor', 'zh-CN': '背景颜色' } },
        setter: { componentName: 'ColorSetter', isRequired: false, initialValue: 'rgba(5,18,34,0.2)' }
      },
      {
        name: 'activeTabTextColor',
        title: { label: { type: 'i18n', 'en-US': 'activeTabTextColor', 'zh-CN': '活跃标签文字颜色' } },
        setter: { componentName: 'ColorSetter', isRequired: false, initialValue: '#FFFFFF' }
      },
      {
        name: 'inactiveTabTextColor',
        title: { label: { type: 'i18n', 'en-US': 'inactiveTabTextColor', 'zh-CN': '非活跃标签文字颜色' } },
        setter: { componentName: 'ColorSetter', isRequired: false, initialValue: 'rgba(255,255,255,0.9)' }
      },
      {
        name: 'headerTextColor',
        title: { label: { type: 'i18n', 'en-US': 'headerTextColor', 'zh-CN': '表头文字颜色' } },
        setter: { componentName: 'ColorSetter', isRequired: false, initialValue: '#56A5FF' }
      },
      {
        name: 'recordTextColor',
        title: { label: { type: 'i18n', 'en-US': 'recordTextColor', 'zh-CN': '记录文字颜色' } },
        setter: { componentName: 'ColorSetter', isRequired: false, initialValue: 'rgba(255,255,255,0.9)' }
      },
      {
        name: 'statValueColor',
        title: { label: { type: 'i18n', 'en-US': 'statValueColor', 'zh-CN': '统计值颜色' } },
        setter: { componentName: 'ColorSetter', isRequired: false, initialValue: '#1AD7FF' }
      },
      {
        name: 'showGradientText',
        title: { label: { type: 'i18n', 'en-US': 'showGradientText', 'zh-CN': '显示渐变文字' } },
        setter: { componentName: 'BoolSetter', isRequired: false, initialValue: true }
      }
    ],
    supports: {
      style: true
    }
  }
};

const snippets: IPublicTypeSnippet[] = [
  {
    title: '物资管理',
    screenshot: '',
    schema: {
      componentName: 'MaterialManagement',
      props: {
        width: 460,
        height: 287,
        tabs: [
          { id: '1', text: '仓库1', isActive: true },
          { id: '2', text: '仓库2', isActive: false },
          { id: '3', text: '仓库3', isActive: false }
        ],
        activeTabBackground: 'http://localhost:8085/static/images/qixiangfangzhai/bz149bf.png',
        inactiveTabBackground: 'http://localhost:8085/static/images/qixiangfangzhai/jxbf2.png',
        borderColor: '#3A4E74',
        backgroundColor: 'rgba(5,18,34,0.2)',
        stats: [
          { label: '物资类别', value: '20', showGradient: true },
          { label: '物资总数', value: '30', unit: '万件', showGradient: true },
          { label: '近半年到期物资数量', value: '30', unit: '万件', showGradient: true }
        ],
        tableHeaders: {
          name: '物资名称',
          quantity: '数量',
          expiring: '近半年到期数量'
        },
        records: [
          { id: '1', name: '一次性防护口罩', quantity: '4450', expiringQuantity: '200' },
          { id: '2', name: '医用外科', quantity: '600', expiringQuantity: '0' },
        ],
        activeTabTextColor: '#FFFFFF',
        inactiveTabTextColor: 'rgba(255,255,255,0.8)',
        headerTextColor: '#56A5FF',
        recordTextColor: 'rgba(255,255,255,0.8)',
        statValueColor: '#1AD7FF',
        statLabelColor: '#FFFFFF',
        showGradientText: true,
        gradientColors: ['#FFFFFF', '#81C6FF'],
        tableRowBackground: 'rgba(16,85,163,0.18)',
        theme: 'dark'
      }
    }
  }
];

export default {
  ...MaterialManagementMeta,
  snippets
};
